UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vdEDm9zJKPB5wtbx0dQBU9wpjk2o6swAazl8ANn0oT8='
WHERE
key_id = 'e7cf61a7f836071ac34a831887b5775b8872f82a6fc5cc5501c9fa89e9053825'
AND (
token = 'vdEDm9zJKPB5wtbx0dQBU9wpjk2o6swAazl8ANn0oT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)