UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KfdnwAypOEJ7LE1Y4nPC8/hKoi4lDfmkT6PwOlX5L+0=' 
WHERE 
  key_id = 'da4a019c7c61250c0bf4258c20483474fdb7f5e4e73c9e19784534a0cccf826e' 
  AND (
    token = 'KfdnwAypOEJ7LE1Y4nPC8/hKoi4lDfmkT6PwOlX5L+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047