UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+n+7CYUqMi6Yn7ENYNs46e4GRrqFK9+oOjjutYNAm+I=' 
WHERE 
  key_id = '777f21b813d3fce7b209662c4bbe3b12b5dd3763c8847cc04e2f9784ff37b82f' 
  AND (
    token = '+n+7CYUqMi6Yn7ENYNs46e4GRrqFK9+oOjjutYNAm+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025