UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7zzDEaZS//1BJlyn+zDP0CvJjYSGnUo7kujruhn/aHA=' 
WHERE 
  key_id = 'd50655f33c077fd079f26c4b3b514a9d8300138e9391133e7be0f13a8979a6a5' 
  AND (
    token = '7zzDEaZS//1BJlyn+zDP0CvJjYSGnUo7kujruhn/aHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044