UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gl1BICK0wYxNkOqQNfZX1SgF0k4QmzjInlxjZRKz4Cw='
WHERE
key_id = '40944ae6e4f4dc495dd3fa341125d310e5e142be0226447014c43a8334723436'
AND (
token = 'gl1BICK0wYxNkOqQNfZX1SgF0k4QmzjInlxjZRKz4Cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)