UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tYk2fM7iIqIL4Lt5f1GgVifIcD+Mr+6I5Sc8KakY89Q='
WHERE
key_id = '822d36acbc1a670672d3a1832389600707791ab711752fefa36150fd85b31bf6'
AND (
token = 'tYk2fM7iIqIL4Lt5f1GgVifIcD+Mr+6I5Sc8KakY89Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)