UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x5k2FzDFDYUQ7d7L2Si/lr7u1EnSRuJntLjyRSVCl6M=' 
WHERE 
  key_id = 'cbaefa6f7ed404d00373450ad9612c398ee4c173d86526247705c806deee7ad5' 
  AND (
    token = 'x5k2FzDFDYUQ7d7L2Si/lr7u1EnSRuJntLjyRSVCl6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045