UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gT3smQCz4HM6WcEbhe7k4CViX+77H/foFRPs/SfJ3Ek='
WHERE
key_id = 'ea80c5e1224360301ed9530c1ba9bb85d02b6bca9004843f7ba160bcb7318a13'
AND (
token = 'gT3smQCz4HM6WcEbhe7k4CViX+77H/foFRPs/SfJ3Ek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)