UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bq7pcXYVtF115kjG2lbAVW+XWmrvfS5NFPWNnWK92Mk=' 
WHERE 
  key_id = '1b794a819b1237c2700c15370e487a44b0efecd6cf43f9a7e9cdd823db84c22c' 
  AND (
    token = 'bq7pcXYVtF115kjG2lbAVW+XWmrvfS5NFPWNnWK92Mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041