UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8RhM7rPJAWusA/dipceUlfeJ2hHTFmNRKKMlZjbcWsU='
WHERE
key_id = '17c46e04ea66e5f30b5aa2b140ab881f82b368ebfc22fd129538332149128256'
AND (
token = '8RhM7rPJAWusA/dipceUlfeJ2hHTFmNRKKMlZjbcWsU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)