UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3HpegCHA0Jr4qqEWx8uCn17pYnYm6HJimL1xjP229bY=' 
WHERE 
  key_id = '9e746c399a233a7596986614573a9d6e25ce2fabd287c2087c5cb7403bbf845c' 
  AND (
    token = '3HpegCHA0Jr4qqEWx8uCn17pYnYm6HJimL1xjP229bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053