UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'efVoRx8YE1Rb1BGf5kvKDHzatkTUaKHTtahPXRlXvU8='
WHERE
key_id = 'ea509b904af68c9a9be06b54a68d59879efe11ce2d05d929d84cdead55b4d8eb'
AND (
token = 'efVoRx8YE1Rb1BGf5kvKDHzatkTUaKHTtahPXRlXvU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)