UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'puFe0oUMGWAldzp4wg3wDswVEdd3v+bzPTDiSaf1LUs=' 
WHERE 
  key_id = '1d765d12c7a6cb2ec8be3d882f5fc5fe6c6452e758cd07977ea79df44ac56807' 
  AND (
    token = 'puFe0oUMGWAldzp4wg3wDswVEdd3v+bzPTDiSaf1LUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050