UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IplRfZh8zkA8SMx9+T6kxTVFyagf8iv63CqbAs3x65Y='
WHERE
key_id = '82d08a7cba4c6e7590b9ab94d552fc5c212f73b3410a12df9c3104bdbebb5186'
AND (
token = 'IplRfZh8zkA8SMx9+T6kxTVFyagf8iv63CqbAs3x65Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)