UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B30nKa+5U5/dsjibBvgGXP611QMydnmxE8P2gTWVQHU=' 
WHERE 
  key_id = '5444a7584d58c28bd8a4370ad0dff267c08604058135950e763df99088c8d536' 
  AND (
    token = 'B30nKa+5U5/dsjibBvgGXP611QMydnmxE8P2gTWVQHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045