UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's9Q0BTXqu5LZBKjlb8JoCnKtJGykb5MfRAXMcSQh+rg=' 
WHERE 
  key_id = '495f3234c63302f0b721d9e72516c242f5206984f36536204d0bdfaa08b69dc4' 
  AND (
    token = 's9Q0BTXqu5LZBKjlb8JoCnKtJGykb5MfRAXMcSQh+rg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051