UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's3YNqDXoIw803AMvQNA+wr5m4Pt2EIBI+woW6fIExLE='
WHERE
key_id = 'e990a24f75e51b16c0b3e9f28ece8f1600aa4d8ee91748077393462ed144ba42'
AND (
token = 's3YNqDXoIw803AMvQNA+wr5m4Pt2EIBI+woW6fIExLE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)