UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KAtC/miOyhvTZPDoKvTo1kfDGpOIYXTmJj/5fgOH/jg=' 
WHERE 
  key_id = '1467f4807945b3603881b01260e9d336c207144a9471fe1a30e4447f0adfc098' 
  AND (
    token = 'KAtC/miOyhvTZPDoKvTo1kfDGpOIYXTmJj/5fgOH/jg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035