UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V5rcc4sZ8C9CqYn9IzPRQKaXHTaUIBZicAslBdDkr+A='
WHERE
key_id = 'd7fca590bba007a62fe5e8979433d3a380b3d8bea62fdb50f45d0d8ec0baeb07'
AND (
token = 'V5rcc4sZ8C9CqYn9IzPRQKaXHTaUIBZicAslBdDkr+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)