UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ry5I7l0sOPOaOmGjOS23q+9MIG+Jkocb/AY9JEY6+5o='
WHERE
key_id = '5ea8379e43dd3310d357a0c0e8dd7e0ca55192c593ab0464675cce09e804aa2a'
AND (
token = 'Ry5I7l0sOPOaOmGjOS23q+9MIG+Jkocb/AY9JEY6+5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)