UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mxUrsUYu3VtSQifUTzZ92Y55ORUJCKJAEV73aTJwvY4='
WHERE
key_id = 'a296fddcaeb79bbcf16351a60fee5c2cb099697e0a9a56534e8befc3639c1be0'
AND (
token = 'mxUrsUYu3VtSQifUTzZ92Y55ORUJCKJAEV73aTJwvY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)