UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aE1JVmPPoGT1nossP1UcieTuHEzXsRvqu2sIuZELU2k='
WHERE
key_id = '402321562b265dadcfa9b06f489615b185ae07b2689bc63fb761b7002f8ef4c8'
AND (
token = 'aE1JVmPPoGT1nossP1UcieTuHEzXsRvqu2sIuZELU2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)