UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M6PI1Plk/GYkSrenAez8Xj1I15tOqFecsy57bqGcRok=' 
WHERE 
  key_id = 'dda990857e03f821ebd454a62f405fe2b6f7e12c57778abbbf3f6fed2deb413f' 
  AND (
    token = 'M6PI1Plk/GYkSrenAez8Xj1I15tOqFecsy57bqGcRok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026