UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNSX3In3N6Ida3LSoKyeoLRkysvobIoHNBgtOIT+ooo=' 
WHERE 
  key_id = '794d33b5024cfadcc04a88899441c18c824c9a0417b0f6da74796b65a74cf822' 
  AND (
    token = 'HNSX3In3N6Ida3LSoKyeoLRkysvobIoHNBgtOIT+ooo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052