UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NzINGH7Z9hjRukn19XGJfcxArczOIt8YaPf2Y/cxd7w=' 
WHERE 
  key_id = '4e631b6b840637d7b348c70ef4e176baaa379067e00959c7eba5303fc7699891' 
  AND (
    token = 'NzINGH7Z9hjRukn19XGJfcxArczOIt8YaPf2Y/cxd7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046