UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oCYcVAH4iH2tmbMRypCquK5fH/almhtHVXuVS5UzFVs='
WHERE
key_id = 'b469dfd1114187f019ea0a23c8e0df19c7f604d80c54e6126883830bc47696c1'
AND (
token = 'oCYcVAH4iH2tmbMRypCquK5fH/almhtHVXuVS5UzFVs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)