UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+32OscrvYS6c6aGC90TDHU3/xf+JJiJcD5wAqNoCF8='
WHERE
key_id = 'a73e0dbac87ee271fbc89abe5ac9d50ed88f0bda4cf22921709beb77a827ce96'
AND (
token = 'N+32OscrvYS6c6aGC90TDHU3/xf+JJiJcD5wAqNoCF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)