UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cpd7i8lHCsOwe/kukFKLRLv3xF1TlxPoW4eE4OxPtmo='
WHERE
key_id = 'c9407dc6f5c17af073431f6594d50ac5367e0c269d94997fef76d5e6ae33648c'
AND (
token = 'cpd7i8lHCsOwe/kukFKLRLv3xF1TlxPoW4eE4OxPtmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)