UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZGYPoxwLQaYoSLMBb1CFplz/UjElmUWxd72mTr0+xwg='
WHERE
key_id = 'c4d37e6538db789ee1f2ee8da4b80e37b9adaf5d6a9b6dd070f9ea91899905e4'
AND (
token = 'ZGYPoxwLQaYoSLMBb1CFplz/UjElmUWxd72mTr0+xwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)