UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e175KK7ZsDzX9OAf5gbqAj8FJR4wL1sxrtqStHkvsmQ=' 
WHERE 
  key_id = '0ed1c391de4e3fb1012e997efcb4c950bd7ffba454bf1c491278bc4c3b43d7a2' 
  AND (
    token = 'e175KK7ZsDzX9OAf5gbqAj8FJR4wL1sxrtqStHkvsmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042