UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B6XB6EAEgjEmfLRwZ2FE0DnXZA3dxrIVCWnBmV75nwI=' 
WHERE 
  key_id = 'a251f6dc645a0785ec57f5dd1cfe2880ae346db8b99b97debfc1c96d009a2554' 
  AND (
    token = 'B6XB6EAEgjEmfLRwZ2FE0DnXZA3dxrIVCWnBmV75nwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025