UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NGQlk+y2y9H2+It1fQsUK/OUM+dyj+Y02OjX18dYHqw=' 
WHERE 
  key_id = '248ac78eadb85289655a998d44f3962b018455eb17b362755553183b42029a7b' 
  AND (
    token = 'NGQlk+y2y9H2+It1fQsUK/OUM+dyj+Y02OjX18dYHqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023