UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3J7v+v/nGVeG+bOvb8/lsUg1N+YfjefQM+U99qwDE00='
WHERE
key_id = 'ae01cbeb0b74232486f822346642a0c509bbf24c27228e1e6344d0329a190ed0'
AND (
token = '3J7v+v/nGVeG+bOvb8/lsUg1N+YfjefQM+U99qwDE00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)