UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TixbXtxCcfmsgNcWg9VD7064X3iPcX454Eujo75VFBI='
WHERE
key_id = '587896f03ed5c1c82ff2757242bce3511ad8c48929aec6db93595b70c4d35936'
AND (
token = 'TixbXtxCcfmsgNcWg9VD7064X3iPcX454Eujo75VFBI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)