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